package cn.topcodes.unicorn.easyui4j;

import lombok.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class TreeNode {
    
    public static final String STATE_OPEN = "open";
    public static final String STATE_CLOSED = "closed";

	private Long id;
	
	private String text;
	
	private String state;
	
	private List<TreeNode> children;
	
	private String iconCls;
	
	private Boolean checked;
	
	private Map<String,Object> attributes;

    public void putAttribute(String key, Object value) {
        if(this.attributes == null) {
            this.attributes = new HashMap<String,Object>();
        } 
        this.attributes.put(key, value);
    }
    
    public void removeAttribute(String key) {
        if(this.attributes != null) {
            this.attributes.remove(key);
        }
    }

}
